Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes a bug when importing blocks in an offline manner (i.e.
./bsc import block_data
).Rationale
Expected Behaviour
Command:
./bsc import block_data
Actual Behaviour
Command:
./bsc import block_data
The error above is primarily triggered by the following function:
bsc/consensus/parlia/parlia.go
Lines 993 to 998 in bd13416
Essentially, for every epoch, the Parlia consensus engine would verify the validators set by calling an RPC method. However, when using the
./bsc import block_data
tool, the RPC API is not available as it purely does block importing and execution. Hence, this results in the error as shown above.There are a few solutions to this problem:
getCurrentValidators
method to not use the RPC method. We may risk breaking crucial components with this approach../bsc import
tool. We only need the RPC API, so other services launched are trivial and add unnecessary processing overhead.The third option is selected. While it may not be the most elegant, it ensures that this tool is working properly with a minimal change to the codebase, and without breaking things.
Changes
noVerifyValidators
to Parlia